package com.bbz.core.concurrency.work9;

public class DBTools {
    volatile private boolean prevIsa=false;
    synchronized public void backupA(){
        try{
            while (prevIsa==false){
                wait();
            }
            for(int i=0;i<5;i++){
                System.out.println("※※※※※※※※※※※※※");
            }
            prevIsa=false;
            notifyAll();
        }catch (InterruptedException e){
            e.printStackTrace();
        }

    }
    synchronized public void backupB(){
        try{
            while (prevIsa==true){
                wait();
            }
            for(int i=0;i<5;i++){
                System.out.println("****************");
            }
            prevIsa=true;
            notifyAll();
        }catch (InterruptedException e){
            e.printStackTrace();
        }

    }


}
